home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / comm / mail / YamLHArx.lha / YamLHArx.yam < prev   
Text File  |  2000-03-26  |  2KB  |  66 lines

  1. /* YamLHArx.yam - View, extract or save attached LhA files in YAM2.0  */
  2. /* Author = J.E. Gilpin <> Original "HandleLHA" author unknown.       */
  3. /* Create a new MIME viewer with the following settings:              */
  4. /* Attachment type = application/x-lha                                */
  5. /* Extension       = lha                                              */
  6. /* Viewer          = rx YAM:rexx/YamLHArx.yam %s                      */
  7. /* LhA, COPY, REQUESTFILE and RX must be in your AmigaDOS search path */
  8.  
  9. PARSE ARG attachmentname
  10. OPTIONS RESULTS
  11. IF ~SHOW(PORTS,'YAM') THEN EXIT
  12. ADDRESS YAM
  13.  
  14. 'Info VAR ScreenName SCREEN'
  15. Console='CON:/33//200/Console/WAIT/CLOSE/SCREEN'||ScreenName
  16.  
  17. 'Request BODY "What shall I do with this archive?" GADGETS "View contents|Extract files|Save archive|Cancel"'
  18. Choice=RESULT
  19. IF Choice=1 THEN ADDRESS COMMAND 'LhA >'Console' v  'attachmentname
  20.  
  21. ELSE IF Choice=2 THEN DO
  22.   ADDRESS COMMAND 'RequestFile > T:destdir.string  DRAWERSONLY DRAWER=RAM: TITLE="Select a destination directory" SAVEMODE PUBSCREEN='ScreenName' '
  23.   IF RC=0 THEN DO
  24.     IF OPEN('DestName','T:destdir.string','R') THEN DO
  25.       Destination=READLN('DestName');
  26.       CALL CLOSE('DestName')
  27.       DestDir=STRIP(Destination,'B','"')
  28.       IF EXISTS(DestDir) THEN DO
  29.          ADDRESS COMMAND 'LhA >'Console' x 'attachmentname' 'DestDir
  30.       END
  31.     END
  32.   END
  33.   IF EXISTS('T:destdir.string') THEN ADDRESS COMMAND 'Delete >NIL: "T:destdir.string"'
  34. END
  35.  
  36. ELSE IF Choice=3 THEN DO
  37.   Information.=0
  38.   'ReadInfo VAR Parts STEM Information.'
  39.   PARSE VAR Parts Number .
  40.   IF Number<1 THEN EXIT
  41.   name=STRIP(attachmentname,'B','"')
  42.   DO count=1 TO Number
  43.     IF Information.tempfile.count=name THEN DO
  44.       RealName=Information.filename.count
  45.       LEAVE
  46.     END
  47.     IF count>=Number THEN EXIT
  48.   END
  49.   ADDRESS COMMAND 'RequestFile > T:dest.string  FILE='RealName' DRAWER=RAM: TITLE="Select a directory and filename" SAVEMODE PUBSCREEN='ScreenName' '
  50.   IF RC=0 THEN DO
  51.     IF OPEN('DestName','T:dest.string','R') THEN DO
  52.       Destination=READLN('DestName');
  53.       CALL CLOSE('DestName')
  54.       DestPath=STRIP(Destination,'B','"')
  55.       length=LASTPOS('/',DestPath)
  56.       IF length=0 THEN length=LASTPOS(':',DestPath)
  57.       IF length~=0 THEN DO
  58.         TestPath=LEFT(DestPath,length)
  59.         IF EXISTS(TestPath) THEN ADDRESS COMMAND 'Copy  'attachmentname' 'DestPath
  60.       END
  61.     END
  62.   END
  63.   IF EXISTS('T:dest.string') THEN ADDRESS COMMAND 'Delete >NIL: "T:dest.string"'
  64. END
  65.  
  66.